package PTA;

import java.util.Scanner;
abstract class Ticket {
    private int number;
    public Ticket(int number) {
        this.number = number;
    }
    public abstract int getPrice();
    public abstract String toString();
    public int getNumber() {
        return number;
    }
}
class WalkupTicket extends Ticket {
    public WalkupTicket(int number) {
        super(number);
    }
    @Override
    public int getPrice() {
        return 50;
    }
    @Override
    public String toString() {
        return "Number:"+getNumber()+",Price:"+getPrice();
    }
}
class AdvanceTicket extends Ticket {
    private int leadTime;
    public AdvanceTicket(int number, int leadTime) {
        super(number);
        this.leadTime = leadTime;
    }
    @Override
    public int getPrice() {
        if(leadTime > 10)
            return 30;
        else
            return 40;
    }
    @Override
    public String toString() {
        return "Number:"+getNumber()+",Price:"+getPrice();
    }
    public int getLeadTime() {
        return leadTime;
    }
}
class StudentAdvanceTicket extends AdvanceTicket {
    private int height;
    public StudentAdvanceTicket(int number, int leadTime, int height) {
        super(number, leadTime);
        this.height = height;
    }
    @Override
    public int getPrice() {
        if(height > 120) {
            if(getLeadTime() > 10)
                return 20;
            else
                return 30;
        }
        else {
            if(getLeadTime() > 10)
                return 10;
            else
                return 15;
        }
    }
    @Override
    public String toString() {
        return "Number:"+getNumber()+",Price:"+getPrice();
    }

}
public class t3 {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        Ticket a = new WalkupTicket(in.nextInt());
        System.out.println(a.toString());
        Ticket b = new AdvanceTicket(in.nextInt(), in.nextInt());
        System.out.println(b.toString());
        Ticket c = new StudentAdvanceTicket(in.nextInt(), in.nextInt(), in.nextInt());
        System.out.println(c.toString());
    }
}
